	// 在首页定义全局公共变量
<<<<<<< HEAD
	const dataDomain = "/"; // 后端数据接口host
=======
	// const dataDomain = "http://101.200.201.27/adm/"; // 后端数据接口host
	//  const dataDomain = "http://localhost/";
	const dataDomain = (function(){
		if(document.domain == '127.0.0.1'){
			return 'http://localhost/'
		}else{
			return 'http://101.200.201.27/adm/'
		}
	}())
	console.log('dataDomain = ', dataDomain)
>>>>>>> cba9cafd673f42ad5454652a82cea5b5ef9bdc87
	const C = { // 常量
		city : '北京',
		gymid : 1383430562842624,
		userid: 1785528
	};
	const D = { // 全局变量
		city: C.city,
		gymid: C.gymid,
		userid: C.userid,
		
	};
	// 公共函数: 页面跳转
	const navito = function(path, filename){
		let fname = 'pages/' + path + "/" + filename + ".html"
		$("main").load(fname, function(){
			console.log(fname)
		})
	}
	
<<<<<<< HEAD
	const post = function(getdata, callback){
		let params = new URLSearchParams();
		params.append('sql', getdata);
		axios.post(dataDomain + 'postdatas.php', params, {headers: {'content-type': 'application/x-www-form-urlencoded'}}).then(function(r){
			// console.log(r);
			callback(r.data);
		}).catch(function(e){
			// console.log(e);
			callback(e)
=======
	// 公共函数，post异步加载
	// url：路径
	// param： 传参
	
	const post = function(url, params, callback){
		$.ajax({
			type: "POST",
			url: url,
			contentType: 'application/json; charset=utf-8',
			data: JSON.stringify(params),
			dataType: 'json',
			success: function(r){
				console.log("ajax successed!")
				callback(r)
			},
			error: function(e){
				console.log("ajax failed!")
				callback(e)
			}
>>>>>>> cba9cafd673f42ad5454652a82cea5b5ef9bdc87
		})
	}

	// 公共函数: 表格同步导出工具
	// filename: 指定文件名, 通常是 csv 扩展名
	// columns: 表格的columns 
	// datas: 表格的datas所在的字段
	// callback: 导出后的动作,通常用来处理下载导出文件
	const download = function(filename, columns, datas){
		let file = [];
		let line = [];
		// console.log('download datas', datas)
		for(let j in columns){
			line.push(columns[j].title);
		}
		file.push(line.join(','));
		for(let j in datas){
			let x = datas[j];
			line = [];
			for(let i in columns){
				line.push("\"" + x[columns[i].field] + "\"");
			}
			file.push(line.join(','));
		}
		// console.log('download file ', file)
		let content = file.join('\n')
		// console.log(file.join('\n'));
		let fullfilename = filename + new Date().format('MM-dd') + '.csv';
		console.log(fullfilename)
		$.ajax({
			url: dataDomain + 'data/savefile.php',
			type: 'POST',
			headers: {'content-type': 'text/html'},
			data: {
				filename: fullfilename, 
				content: content
			},
			dataType: 'text',
			success: function(r){
				console.log(r)
				window.open(dataDomain + "data/download/" + fullfilename, '_blank')
			}
		})
	}
	
<<<<<<< HEAD
=======
	var nav_vm = new Vue({
		el: '#nav_vm',
		data: {
			
			mainmenu: [
				
				{name: '门店查询', type: 'dir', status: 'open', children: [
					{name: '签约情况', type: 'page', path: 'gyms', filename: 'signup'},  // 二级选项: 当日,当月,当年,累计
					{name: '课程表', type: 'page', path: 'gyms', filename: 'timetable'},
					{name: '上课4次以上', type: 'page', path: 'gyms', filename: 'monthly_userclasses'},
				]},

				{name: '会员查询', type: 'dir', status: 'open', children: [
					{name: '综合查询', type: 'page', path: 'users', filename: 'searchusers'},
					{name: '教练私海', type: 'page', path: 'users', filename: 'userpool'},
					{name: 'top学员', type: 'page', path: 'users', filename: 'topusers'},
				]},
				
				{name: '统计图表', type: 'dir', status: 'open', children: [
					{name: '收入图表', type: 'page', path: 'charts', filename: 'incomes'},
					{name: '用户画像', type: 'page', path: 'charts', filename: 'users_chart'},
					// {name: '约课情况', type: 'page', path: 'charts', filename: 'ty_classes'},
					{name: '转化续课', type: 'page', path: 'charts', filename: 'rates'},
					
				]},
				
				{name: '线上课', type: 'dir', status: 'open', children: [
					{name: '分时用户量', type: 'page', path: 'zhibo', filename: 'zhibo_users'},
					{name: '课程平均人数', type: 'page', path: 'zhibo', filename: 'zhibo_classes'},
					{name: '每日课程人数', type: 'page', path: 'zhibo', filename: 'users_count'},
					
				]},
				
				{name: '活动数据', type: 'dir', status: 'close', children: [
					{name: '减重大赛', type: 'page', path: 'activity', filename: 'fat_match'},
					{name: '减重个人赛', type: 'page', path: 'activity', filename: 'fat_match_person'},
				]},
				
				// {name: '查询表', type: 'dir', status: 'close', children: [
				// 	{name: 'sj', type: 'page', path: 'gyms', filename: 'sj'},
				// 	{name: 'tj', type: 'page', path: 'gyms', filename: 'tj'},
				// ]},
			],
			userlogin: {user_name: ""},
			showMenu: false,
			curdir: "",
			curpage: "",
		}, 
		methods: {
			clickMenuItem: function(item){ 
				
				if(this.curdir == item.path && this.curpage == item.filename) return;  // 点击相同的页面,不需要重复加载
				console.log(item.filename)
				if(item.type == 'page'){
					this.curdir = item.path
					this.curpage = item.filename;
					this.navito(item.path, item.filename);
				}else{
					if(item.status == 'open'){
						item.status = 'close'
					}else{
						item.status = 'open'
					}
				}
				
			},
			navito: function(path, filename){ navito(path, filename) }
		},
		mounted(){
	
		}
	})	
>>>>>>> cba9cafd673f42ad5454652a82cea5b5ef9bdc87
	
	